<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>企业资质澄清（生产企业端）</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
<link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<style type="text/css">
	#shclNs {
           position:fixed;
           left:0px;
           top:0px;
           width:100%;
           height:100%;
           opacity:0.75;
           -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=75)";
           filter:alpha(opacity=75);
           background-color: gray;
           margin:0px;
           padding:0px;
           z-index:999999;
           background:url('${ctx}/lib/img/loading.gif') no-repeat center center;
        }
</style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame" style="height:650px;overflow-y:scroll;"  >
<div id="shclNs" ></div>
<div class="box box-primary" id="more" style="width:110px;height:35px;background-color:#222c32;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#222c32;">
            <div class="box-body home-message" id="moreOp" >
            </div>
</div>
    <section class="content-header">
        <h1>企业资质澄清</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">药品招标管理</a></li>
            <li class="active"><a href="#">资质管理</a></li>
            <li class="active"><a href="#">企业资质澄清</a></li>
        </ol>
        
</section>
<section class="content" >
<div class=" box box-success"  >
<div id="wrapper">
<div id="content" ></div>

<script id="test" type="text/html">
  {{each rows as row i}}
            <div class="col-xs-6 col-lg-4 hei">
                <div class="wrapper2 ">
                    <a id=""  href="javascript:showImg('{{row.profilePicAddr}}','{{row.profileName}}');" ><img class="img-responsive" border="0" src="${ctx}/{{row.profilePicShortcutAddr}}"></a>
                    <div class="row" style=" margin-left: -12;margin-left: -23px;" >
                        <div class="col-md-12">
                            <p class="pull-left imgButton">
                                <button type="button" class="btn btn-primary btn-sm" style="margin-left: 1px;" id="submitDicCompType" onclick="edit('{{row.compprofileId}}','{{row.profileCode}}','{{row.profileName}}','{{row.profileStarttime}}','{{row.profileEndtime}}','{{row.profilePicAddr}}','{{row.remarks}}');" style="margin-left:10px">编&nbsp;&nbsp;辑</button>
                                <button type="button" class="btn btn-primary btn-sm" id="submitDicCompType" onclick="changeComplainStatus('{{row.auditStatus}}','{{row.compprofileId}}');">提&nbsp;&nbsp;交</button>
                                
                            </p>
                        </div>
                    </div>
                    <div class="row" style="margin-left:0px">
                        <div class="col-md-12">
                            <p class="pull-left">
                                <div class="productInfo" >&nbsp;编号:<span class="productInfo" name="profileCode" >{{row.profileCode}}</span></div>
                            </p>
                        </div>
                    </div>
                    <div class="row"  style="margin-left:0px">
                        <div class="col-md-12">
                            <p class="pull-left">
                                <div class="productInfo" >&nbsp;名称:<span class="productInfo" name="profileCode" >{{row.profileName}}</span></div>
                            </p>
                        </div>
                    </div>
                    <div class="row"  style="margin-left:0px">
                        <div class="col-md-12">
                            <p class="pull-left">
                                 <div class="productInfo" >&nbsp;有效期:<span class="productInfo" name="profileTime" >&nbsp;{{row.profileStarttime}}&nbsp;&nbsp;至&nbsp;&nbsp;{{row.profileEndtime}}</span></div>
                            </p>
                        </div>
                    </div>
                    <div class="row"  style="margin-left:0px">
                        <div class="col-md-12">
                            <p class="pull-left">
                                <div class="productInfo" >&nbsp;状态:<span class="productInfo" name="status" >{{row.status | formatStatus}}</span></div>
                            </p>
                        </div>
                    </div>
                    <div class="row"  style="margin-left:0px">
                        <div class="col-md-12">
                            <p class="pull-left">
                                <div class="productInfo" >&nbsp;备注:<span class="productInfo" name="remarks" >{{row.remarks}}</span></div>
                            </p>
                        </div>
                    </div>
                    <div class="row"  style="margin-left:0px">
                        <div class="col-md-12">
                            <p class="pull-left">
                                <div class="productInfo" >&nbsp;备注:<span class="productInfo" name="complainRemarks" >{{row.complainRemarks}}</span></div>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
 {{/each}}
        </script>   
            
            
        </div>





 <div class="row productall">
          <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header bg-primary">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h5 class="modal-title" id="exampleModalLabel">企业资质</h5>
                    </div>
                    <form  id="form" action="${ctx }/prodProfile/saveProfile.html" method="post" enctype="multipart/form-data">
                    <div class="modal-body">
                        <div class="form-group form-group-xs">
                            <label for="recipient-name" class="control-label">名称：</label>
                            <div class="" >
                                <input type="text" class="form-control" id="profileName" name="profileName" placeholder="产品资质名称" maxlength="128">
                            </div>
                        </div>
                        <div class="form-group form-group-xs">
                            <label for="recipient-name" class="control-label">类型：</label>
                            <div class="" >
                               <select class="form-control"   id="profileType" name="profileType" style="width:200px;display:inline-block;">
                                 <option value="">请选择</option>
                                 <option value="1">国有</option>
                               </select>
                            </div>
                        </div>
                        <div class="form-group form-group-xs" >
                            <label for="recipient-name" class="control-label">图片：</label>
                               <div class="">
                                        <input id="acctApprovalPicDir" name="licence" type="file" style="display:inline-none;" />
                                  </div>
                        </div>
                        <div class="form-group form-group-xs">
                            <label>有效期开始时间：</label>
                                <div class="input-group">
                                      <input class="form-control" type="text" name="profileStarttime" id="createTimeBegin"    placeholder="yyyy-MM-dd"
                                      onFocus="var endDate=$dp.$('createTimeEnd');WdatePicker({maxDate:'#F{$dp.$D(\'createTimeEnd\')}'})" maxlength="25"/>
                                </div>
                            </div>
                        <div class="form-group form-group-xs">
                            <label>有效期截至时间：</label>
                                <div class="input-group">
                                     <input class="form-control" type="text" name="profileEndtime" id="createTimeEnd"   placeholder="yyyy-MM-dd" maxlength="25"
                                        onFocus="WdatePicker({minDate:'#F{$dp.$D(\'createTimeBegin\')}'})" />
                                </div>
                        </div>
                        
                        <div class="form-group form-group-xs">
                            <label for="txtDrugForm">备注：</label>
                           <textarea class="form-control"  placeholder="备    注" id="remark" name="remarks" maxlength="4000" ></textarea>
                       </div>
                       <div class="form-group form-group-xs">
                            <label for="complainRemark">澄清备注：</label>
                           <textarea class="form-control"  placeholder="备    注" id="complainRemark" name="complainRemarks" maxlength="4000" ></textarea>
                       </div>
                       <input type="text" id="compprofileId" name="compprofileId" style="display:none" />
                        <div id="twoSpec" style="display:none"></div>
                    </div>
                    </form>
                    <div class="modal-footer"   >
                     <input hidden="true" id="spid"/>
                       <input hidden="true" id="spfatherid"/>
                        <button type="button" class="btn btn-primary btn-sm" id="submitDicCompType" onclick="save();" >保&nbsp;存</button>
                        <button type="button" class="btn btn-danger btn-sm" data-dismiss="modal" id="closeDicCompType">关&nbsp;闭</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div style="height:50px"></div>
</section>
 
<div class="mainA">
<div class="mainB"></div>
<div class="mainC" style="background-color:#F39C12;" ></div>
<div class="main" >
    <a href="javascript:history.go(-1)" class="btn btn-danger btn-sm">返&nbsp;&nbsp;回</a>     
</div>
</div>

</body>
</html>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">

/*格式化启用/停用   用于页面显示*/
template.helper('formatStatus', function(data) {
    return data == 1 ? "启用" : "停用";
});
var records = 0;//总条目
var postData = {"rows":6,"page":1};//rows 一页展示多少条   page当前页数
    $(function() {

        //停用启用
        $('#showOperate').children().eq(0).bind("click", function() {
            alert("WO " + $('#showOperate').children().eq(0).html());
        })

        
        getList(postData);
        $(window).scroll(function() {
            if ($(document).scrollTop() >= $(document).height() - $(window).height()) {
                postData.page++;
                if (postData.page <=Math.ceil(records/postData.rows)) {
                    getList(postData);
                } 
            }
         });
});
    function getList(postData){
        $("#shclNs").show();
            $.post('${ctx}/prodProfile/getProfileList.html?projId=${projId}',
                    postData, function(result) {
                        if (result.success) {
                            $("#shclNs").hide();
                            var html = template('test', result);
                            $('#content').append(html);
                            records=result.records;  //总条数
                        } else {
                            $.HN.message.alert("数据获取失败", '信息', 'error');
                        }
                    }, "json");
        }
    
    
    
    //提交
      function changeComplainStatus(auditStatus,compprofileId) {
         var params = [];
        params.push({"compprofileId":compprofileId,"projId":"${projId}"});
        $.HN.message.confirm("确定提交吗？", '', '').on(function (e) {
              if (e) {
        $.post("${ctx}/prodProfile/submitProfileList.html", {
            "array" : json.jsonToString(params)
        }, function(result) {
            if (result.success) {
                $.HN.message.alert("操作成功！", "消息", "success");
            } else {
                $.HN.message.alert("操作失败！", "消息", "error");
            }
        }, "json");
              }
          }); 
     
    }  
     
    function edit(compprofileId, profileCode,profileName,profileStarttime,profileEndtime,profilePicAddr,remarks,compId) {
        $('#profileCode').val("");
        $('#profileName').val("");
        $('#createTimeBegin').val("");
        $('#createTimeEnd').val("");
        $('#remark').val("");
        $('#complainRemark').val("");
        $('#acctApprovalPicDir').val("");
        $('#compprofileId').val();
        $('#exampleModalLabel').html("企业资质澄清");
        $('#exampleModal').modal({
            keyboard : true
        });
        $('#profileCode').val(profileCode);
        $('#profileName').val(profileName);
        $('#createTimeBegin').val(profileStarttime);
        $('#createTimeEnd').val(profileEndtime);
        $('#remark').val(remarks);
        $('#complainRemark').val(complainRemark);
        $('#compprofileId').val(compprofileId);
    }

    function validate() {
        var profileName = $.trim($("#profileName").val());
        if (profileName == null || profileName == "") {
            $.HN.message.alert("请输入企业资质名称！", "消息", "info");
            return false;
        }
        var createTimeBegin = $.trim($("#createTimeBegin").val());
        if (createTimeBegin == null || createTimeBegin == "") {
            $.HN.message.alert("请选择启用时间！", "消息", "info");
            return false;
        }

        var createTimeEnd = $.trim($("#createTimeEnd").val());
        if (createTimeEnd == null || createTimeEnd == "") {
            $.HN.message.alert("请选择停用时间！", "消息", "info");
            return false;
        }
        return true;
    }
    //保存
    function save() {
        if (validate()) {
        $.HN.message.confirm('确定要保存吗？', '提示信息', '确定').on(
                function(e) {
                    if (e) {
                        $("#form").ajaxSubmit(
                                {
                                    dataType : "json",
                                    timeout : 10000,
                                    success : function(result, statusText) {
                                        if (result.success) {
                                            $('#content').empty();
                                            postData.page=1;
                                            console.log("赋值"+JSON.stringify(postData));
                                            $('#exampleModal').modal('hide');
                                            getList(postData);
                                            $.HN.message.alert("操作成功！", "消息","success");
                                        } else {
                                            $.HN.message.alert(result.msg || "操作失败！", "消息", "error");
                                        }
                                    }
                                });

                    }
                });
        }
    }
    function showImg(imgPath,profileName) {
        var url = "/medstgmini/acctInfo/toImg.html";
        $.HN.dialog.open({
            "id" : "showImg",
            "title" : profileName,
            "url" : url,
            "data" : {
            "imgPath" : imgPath
            },
            "width" : 800,
            "height" : 400,
            "closefunc" : function(params) {
                if (params) {

                }
            }
        });
    }
</script>